/*
 * srcMixTask.cpp
 *
 *  Created on: 22 gru 2013
 *      Author: dawid.wysakowicz
 */

#include "threads/MixTask.hpp"
#include "Mixer.hpp"

namespace threads
{

MixTask::MixTask(dna::marker& input, std::list<std::list<dna::genotype> >& results, std::mutex& resultGuard) :
		input_(input), results_(results), resultGuard_(resultGuard)
{
}

void MixTask::operator ()()
{
	mixer::Mixer mixer;
	const std::list<dna::genotypeSet >& result = mixer.combineGenotypes(input_);

	{
		std::unique_lock<std::mutex> lock(resultGuard_);
		results_.insert(results_.end(), result.begin(), result.end());
	}
}

MixTask::~MixTask()
{
}

} /* namespace threads */
